import request from '@/utils/request.js'

/*登录*/
export function code2SessionAPI(code){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/code2Session?code=${code}`,
		method: 'GET'
	})
}

export function getUserInfoByOpenidAPI(openid){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getUserInfoByOpenid?openid=${openid}`,
		method: 'GET'
	})
}

export function updateUserInfoAPI(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/updateUserInfo`,
		method: 'POST',
		data
	})
}

/*我的*/
// 获取我的消息
export function getNoticeByOpenid(){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getNoticeByOpenid`,
		method: 'GET'
	})
}

// 投诉和建议
export function suggestionsAPI(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/suggestions`,
		method: 'POST',
		data
	})
}

// 游客列表
export function getTouristInfoListByOpenid(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getTouristInfoListByOpenid?openid=${data}`,
		method: 'GET'
	})
}

// 新增游客
export function createTouristInfo(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/createTouristInfo`,
		method: 'POST',
		data
	})
}

// 修改游客
export function updateTouristInfo(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/updateTouristInfo`,
		method: 'POST',
		data
	})
}

// 获取预约订单列表
export function getOrdersListByOpenid(){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getOrdersListByOpenid`,
		method: 'GET'
	})
}

// 根据订单id获取预约订单详细信息
export function getOrdersInfoByOrderId(orderId){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getOrdersInfoByOrderId?orderId=${orderId}`,
		method: 'GET'
	})
}

/*首页*/
// 获取特别提示信息
export function getAttention(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getAttention`,
		method: 'GET'
	})
}

// 获取新闻列表
export function getNewsList(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getNewsList`,
		method: 'GET'
	})
}

// 获取新闻详情
export function getNewsById(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getNewsById`,
		method: 'GET'
	})
}

// 获取预约日期
export function getOrdersDay(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getOrdersDay`,
		method: 'POST'
	})
}

// 获取博物馆的景区信息
export function getJZMuseumAttractionsInfo(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getJZMuseumAttractionsInfo`,
		method: 'GET'
	})
}

// 获取可预约日期日历
export function getAttractionsOrderDays(attractionsId){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/getAttractionsOrderDays?attractionsId=${attractionsId}`,
		method: 'GET'
	})
}

// 提交预约订单
export function commitOrder(data){
	return request({
		url: `/miniapp-api/yonghengjingzhang/v1/commitOrder`,
		method: 'POST',
		data
	})
}